/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package FarmacieDAL;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "CHITANTA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Chitanta.findAll", query = "SELECT c FROM Chitanta c"),
    @NamedQuery(name = "Chitanta.findByIdChitanta", query = "SELECT c FROM Chitanta c WHERE c.idChitanta = :idChitanta"),
    @NamedQuery(name = "Chitanta.findByData", query = "SELECT c FROM Chitanta c WHERE c.data = :data"),
    @NamedQuery(name = "Chitanta.findByIdReteta", query = "SELECT c FROM Chitanta c WHERE c.idReteta = :idReteta")})
public class Chitanta implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_CHITANTA")
    private Integer idChitanta;
    @Column(name = "DATA")
    @Temporal(TemporalType.TIMESTAMP)
    private Date data;
    @Column(name = "ID_RETETA")
    private Integer idReteta;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idChitanta")
    private Collection<DetaliiChitanta> detaliiChitantaCollection;

    public Chitanta() {
    }

    public Chitanta(Integer idChitanta) {
        this.idChitanta = idChitanta;
    }

    public Integer getIdChitanta() {
        return idChitanta;
    }

    public void setIdChitanta(Integer idChitanta) {
        this.idChitanta = idChitanta;
    }

    public Date getData() {
        return data;
    }

    public void setData(Date data) {
        this.data = data;
    }

    public Integer getIdReteta() {
        return idReteta;
    }

    public void setIdReteta(Integer idReteta) {
        this.idReteta = idReteta;
    }

    @XmlTransient
    public Collection<DetaliiChitanta> getDetaliiChitantaCollection() {
        return detaliiChitantaCollection;
    }

    public void setDetaliiChitantaCollection(Collection<DetaliiChitanta> detaliiChitantaCollection) {
        this.detaliiChitantaCollection = detaliiChitantaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idChitanta != null ? idChitanta.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Chitanta)) {
            return false;
        }
        Chitanta other = (Chitanta) object;
        if ((this.idChitanta == null && other.idChitanta != null) || (this.idChitanta != null && !this.idChitanta.equals(other.idChitanta))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "FarmacieDAL.Chitanta[ idChitanta=" + idChitanta + " ]";
    }
    
}
